package 剑指offer;

import java.util.Scanner;

/**
 * 道就是将"￥111"转化为"一百一十一元整"，
 *
 * @author Administrator
 *
 */
public class 转化为人名币2 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		char arrNum[] = { '十', '百', '千', '万' };
		char arrSys[] = { '零', '一', '二', '三', '四', '五', '六', '七', '八', '九', };
		String x = scanner.next();
		String num = "";
		int temp = 0;
		boolean flag = true; // 有两个零相邻
		for (int i = 0; i < x.length(); i++) {
			int sys = Integer.parseInt(String.valueOf(x.charAt(x.length() - 1 - i)));//遍历输入的数据
			temp = temp > 4 ? 1 : temp; // 129050，当位数大于4时，temp变为1
			if (temp != 0 && sys != 0) {
				num = String.valueOf(arrSys[sys]) + String.valueOf(arrNum[temp - 1]) + num;
				flag=false;
			} else if (i>=4&&i % 4 == 0 && sys == 0) {
				num = String.valueOf(arrNum[i - 1]) + num;
				flag = true;
			}
			else if (temp ==0&&sys!=0) {
				num = String.valueOf(arrSys[sys]) + num;
				flag = false;
			}else if(!flag){
				num = String.valueOf(arrSys[sys]) + num;
				flag = true;
			}
			temp++;

		}
		System.out.println(num + "元整");

	}

}
